package com.bsoft.consumer;

import com.alibaba.fastjson.JSON;
import com.bsoft.message.Demo05Message;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
@RabbitListener(queues = Demo05Message.QUEUE,
        containerFactory = "consumerBatchContainerFactory")
public class Demo05Consumer {
    @RabbitHandler
    public void onMessage(List<Demo05Message> message) {
        log.info(JSON.toJSONString(message));
        log.info("[onMessage][线程编号:{} 消息数量：{}]", Thread.currentThread().getId(), message.size());

    }

}
